const db = require('../db/db');

//公司内容展示/搜索
exports.company = (req,res) => {
    const company = req.query.com_name;
    const sqlstr = 'select * from company where com_name =?  and status =0';
    db.query(sqlstr,company,(err,result)=>{
        if(err) return console.log(err.message);
        res.send(JSON.parse(JSON.stringify(result)));
    })
    //[{"com_name":"ceshi","com_region":"ceshi","com_place":"ceshi","status":0}]
}

//后台展示所有公司
exports.all_com = (req,res) => {
    const sqlstr = 'select * from company';
    db.query(sqlstr,(err,result)=>{
        if(err) return console.log(err.message);
        res.send(JSON.parse(JSON.stringify(result)));
    })
    //[{"com_name":"ceshi","com_region":"ceshi","com_place":"ceshi","status":0}]
}

//后台公司内容展示/搜索
exports.hsearch_com = (req,res) => {
    const company = req.query.com_name;
    const sqlstr = 'select * from company where com_name =?';
    db.query(sqlstr,company,(err,result)=>{
        if(err) return console.log(err.message);
        res.send(JSON.parse(JSON.stringify(result)));
    })
    //[{"com_name":"ceshi","com_region":"ceshi","com_place":"ceshi","status":0}]
}

